#ifndef CIRSINGLYLISTOPS_H__
#define CIRSINGLYLISTOPS_H__

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

// 去掉输入缓冲区中多余的字符包括换行等
#define eatline ({while(getchar()!='\n'){continue;}})

typedef int DataType;

typedef struct Node{
    DataType data;
    struct Node *link;
} Node, *NodePointer;

typedef struct List{
    NodePointer first;
    NodePointer last;
    int lenth;
} CirSglList;

Node* NewNode(DataType nodeData);
short isEmpty(CirSglList *list);

void initList(CirSglList *list);
void displayList(CirSglList *list);
short insertAtTheEnd(CirSglList *list, DataType insertData);
short insertAtTheBeginning(CirSglList *list, DataType insertData);
short insertToOrderedList(CirSglList *list, DataType insertData);
int getLenth(CirSglList *list);
short deleteLastData(CirSglList *list);
short deleteFirstData(CirSglList *list);

#endif